﻿using System;
using HslCommunication.Core.Address;
using HslCommunication.Profinet.Melsec;

namespace HslCommunication.Profinet.Keyence
{
	/// <summary>
	/// 基恩士PLC的数据通信类，使用QnA兼容3E帧的通信协议实现，使用ASCII的格式，地址格式需要进行转换成三菱的格式，详细参照备注说明<br />
	/// Keyence PLC's data communication class is implemented using QnA compatible 3E frame communication protocol. 
	/// It uses ascii format. The address format needs to be converted to Mitsubishi format.
	/// </summary>
	/// <remarks>
	/// <inheritdoc cref="T:HslCommunication.Profinet.Keyence.KeyenceMcNet" path="remarks" />
	/// </remarks>
	// Token: 0x0200008C RID: 140
	public class KeyenceMcAsciiNet : MelsecMcAsciiNet
	{
		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceMcNet.#ctor" />
		// Token: 0x06000ACF RID: 2767 RVA: 0x00040657 File Offset: 0x0003E857
		public KeyenceMcAsciiNet()
		{
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceMcNet.#ctor(System.String,System.Int32)" />
		// Token: 0x06000AD0 RID: 2768 RVA: 0x00040661 File Offset: 0x0003E861
		public KeyenceMcAsciiNet(string ipAddress, int port) : base(ipAddress, port)
		{
		}

		/// <inheritdoc />
		// Token: 0x06000AD1 RID: 2769 RVA: 0x0004066D File Offset: 0x0003E86D
		protected override OperateResult<McAddressData> McAnalysisAddress(string address, ushort length)
		{
			return McAddressData.ParseKeyenceFrom(address, length);
		}

		/// <inheritdoc />
		// Token: 0x06000AD2 RID: 2770 RVA: 0x00040676 File Offset: 0x0003E876
		public override string ToString()
		{
			return string.Format("KeyenceMcAsciiNet[{0}:{1}]", this.IpAddress, this.Port);
		}
	}
}
